<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@taglib prefix="accessory" uri="http://accessoryPackageTag.weitu.net" %>
<%@taglib uri="http://workflowReviewTag.weitu.net" prefix="flow" %><!--工作流审批处理标签-->
<!doctype html>
<html lang="zh">
<head>
    <title>业务表单</title>
    <%@include file="/common/header.jspf"%>
    <script type="text/javascript">
        var loginUserName = '${loginUser.name}';
        var loginUserId = '${loginUser.id}';
        var loginUserRealName ='${loginUser.realName}';
        var recogniseUserIds = '${info.userIds}';
        var recogniseUserNames = '${info.userNames}';
        var recogniseId = '${info.id}';
        var recogniseType = '${info.type}';//识别对象类型
    </script>
    <style type="text/css">
        .tagbox{
            line-height: 30px;
            width: 240px;
            /*height: 30px;*/

        }
        .tagbox-label{
            height: 20px !important;
            line-height: 20px !important;
            background-color: #AFEEEE;
            font-size: 13px !important;
            margin:3px 1px 1px 1px;

        }
    </style>
    <style>
        .flow_review{

            width:100%;
            margin-bottom:20px;
        }
        .flow_review .review_title{
            width:100px;
            text-align: right;
        }
        .flow_review>table{
            width:100%;
        }
        .flow_review label{
            float:left;
            width:50px;
        }
        .flow_review label>input{
            width:10px;
        }
        .flow_review textarea{
            width:80%;
        }
        .flow_review .review_next_check{
            width:100%;
        }
        /*.flow_review .review_result{
            padding-left:20%;
            height:30px;
            line-height:30px;
        }
        .flow_review .review_result>label{
            width:50px;
            float:left;
        }
        .flow_review .review_result>label>input{
            width:10px;
        }
        .flow_review  .review_comments{
            height:auto;
        }
        .flow_review  .review_comments>textarea{
            margin-left:10%;
            width:80%;
        }*/
    </style>
    <script src="${ctx}/resources/js/risk/recognise/verify.js" type="text/javascript"></script>
</head>
<body>
<div class="menu-right" style="">
    <a class="button icon-save" id="btn_save">
        保存
    </a>
    <%--  <a class="button icon-refer" id="">
        提交
    </a>
    <a class="button icon-export">
        导入
    </a>--%>
</div>

    <div class="information">
        <div class="information-title">
            <p>风险基本信息</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="cuttle" style="height: 220px;">
            <form id="recogniseForm1" method="post">
                <input type="hidden" id="id" name="id" value="${info.id}">
            <div style="clear: both">
                <div class="form_one">
                    <label class="lable-style">识别对象类型:</label>
                    <%--<input type="text" class="easyui-textbox" style="width: 240px;" required="true" name="type">--%>
                    <select id="recogniseType" class="easyui-combobox" style="width: 240px;" name="type" panelMaxHeight="50px"
                            required="true" editable="false" readonly="true">
                        <option value="0" <c:if test="${info.type eq 0}">selected</c:if>>设备设施</option>
                        <option value="1" <c:if test="${info.type eq 1}">selected</c:if>>作业活动</option>
                       </select>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">识别单位:</label>
                    <%-- <select class="easyui-combobox" style="width: 240px;" name="deptId" id="deptSelect">
                         <option value="1">请选择</option>
                     </select>--%>
                    <input id="dept" class="easyui-textbox" style="width: 240px;" required="true" validType="validSelect" name="deptId"
                           value="${info.deptId}" readonly="true">
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">风险区域:</label>
                    <input type="hidden" id="regionId" name="regionId" value="${info.regionId}">
                    <input class="easyui-textbox" style="width: 240px;" id="region" required validType="validRegionSelect['#regionId']"
                           value="${info.regionId}" readonly="true">
                    <span>*</span>
                </div>
            </div>
            </form>
            <form id="job1">
            <div style="clear: both;display: none;" class="job">
                <div class="form_one">
                    <label class="lable-style">作业类型:</label>
                    <input id="jobTypeId" type="text" class="easyui-textbox" style="width: 240px;"
                           validType="validSelect" editable="false" name="jobTypeId" value="${info.jobTypeId}">
                </div>
                <div class="form_one" style="width:720px">
                    <label class="lable-style">作业活动:</label>
                    <input type="text" class="easyui-textbox" style="width:598px;" required="true"
                           name="jobContent" value="${info.jobContent}" readonly>
                    <span>*</span>
                </div>
            </div>
            </form>
            <div style="clear: both">
                <form id="job2">
                <div class="form_one job" style="display: none;">
                    <label class="lable-style">作业项目:</label>
                    <input type="hidden" id="jobProjectId" name="jobProjectId" value="${info.jobProjectId}">
                    <input id="jobProject" name="jobProject" class="easyui-textbox" editable="false" style="width: 240px;"
                           value="${info.jobProjectName}" readonly>
                    <%--<input id="" name="jobProject" class="easyui-textbox" editable="false" required="true"  style="width: 240px;">--%>
                </div>
                </form>
                <form id="equipment">
                <div class="form_one equipment" >
                    <label class="lable-style">风险点:</label>
                    <input type="hidden" id="regionPointId" name="regionPointId" value="${info.regionPointId}">
                    <input id="regionPoint" name="regionPoint" class="easyui-textbox" editable="false" required="true" style="width: 240px;"
                           value="${info.regionPointId}" readonly>
                    <%--<select class="easyui-combobox" style="width: 240px;" name="reasonId">
                            <option value="">请选择</option>
                        </select>--%>
                    <span>*</span>
                </div>
                </form>
                <form id="recogniseForm2">
                <div class="form_one">
                    <label class="lable-style">评价人员:</label>
                    <%--<input type="hidden" id="recogniseUserIds" name="recogniseUserIds" >--%>
                    <input id="recogniseUsers" name="recogniseUserIds"  class="easyui-textbox" multiline
                           style="width: 240px;" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">评价日期:</label>
                    <input id="hdSource" class="easyui-datebox" name="recogniseDate" editable="false" required="true" validType="validSelect"
                           style="width: 240px;" editable="false" value="${info.recogniseDate}" readonly>
                    <span>*</span>
                </div>
                </form>
            </div>
            <form id="recogniseForm3">
            <div style="clear: both">
                <div class="form_one">
                    <label class="lable-style">评价方法:</label>
                    <input id="methodTypeId" class="easyui-textbox" style="width: 240px;" required="true" editable="false" validType="validSelect"
                           name="methodTypeId" value="${info.methodTypeId}" readonly>
                    <span>*</span>

                </div>

            </div>
            </form>
        </div>

    </div>

<form id="detailForm">
    <div class="information">
        <div class="information-title">
            <p>风险评价明细信息</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="enclosure"style="height:300px;" id="detailListDiv">
            <table id="detailList">
            </table>
            <div id="tb" style="display: none">
                <%--<a id="btn_detail_add" href="javascript:void(0)" class="easyui-linkbutton" iconCls="fa fa-plus fa-lg" style="margin:5px;"
                   onclick="appendTableRow()">添加</a>
                <a id="btn_detail_delete" href="javascript:void(0)" class="easyui-linkbutton" iconCls="fa fa-trash fa-lg" style="margin:5px;"
                   onclick="deleteTableRow()">删除</a>
                <a id="btn_detail_edit" href="javascript:void(0)" class="easyui-linkbutton" iconCls="fa fa-edit fa-lg" style="margin:5px;"
                   onclick="editTableRow()">编辑</a>
                <a id="btn_detail_save" href="javascript:void(0)" class="easyui-linkbutton" iconCls="fa fa-save fa-lg" style="margin:5px;"
                   onclick="saveTableRow()">保存</a>
                <a id="btn_detail_reject" href="javascript:void(0)" class="easyui-linkbutton" iconCls="fa fa-reply fa-lg" style="margin:5px;"
                   onclick="rejectTableRow()">撤销</a>--%>
            </div>
        </div>
    </div>
</form>
<form id="verifyForm">
    <input type="hidden" name="businessId" value="${info.id}" >
    <input type="hidden" name="workItemId" value="${workItemId}" />
    <input type="hidden" name="step" value="${step}" />
    <div class="information" >
        <div class="information-title">
            <p>审批信息</p>
            <a href="#"><img src="${ctx}/resources/themes/images/alias_03.png" width="18"></a>
        </div>
        <div class="input-wrap" style="">
            <!--工作流审批意见-->
            <flow:review requestName="workflowReview" workItemId="${workItemId}"/>

        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $(function () {
        /***
         * 审批操作
         */
        $('#btn_save').on("click", function () {

            $.messager.progress();	// 显示进度条
            var data=$("#verifyForm").serializeJson();
            if(!checkVerifyResult('workflowReview')){
                $.messager.progress('close');
                return false;
            }
            //表单提交
            $('#verifyForm').form('submit', {
                url: ROOT_PATH + '/risk/recognise/verifyApplication.shtml',
                data:data,
                onSubmit: function (param) {
                    return true;	// 返回false终止表单提交
                },
                success: function (result) {
                    try {
                        result = $.parseJSON(result);
                    }catch (e) {
                        $.messager.progress('close');
                        parent.layer.msg(result.message,{time:1000,icon:2});
                    }
                    if (result.success){
                        $.messager.progress('close');	// 如果提交成功则隐藏进度条
                        parent.layer.msg(result.message,{time:1000,icon:1},function () {
                            WindowManager.closeLayer();//关闭窗口
                        });
                    }else {
                        $.messager.progress('close');	// 如果提交失败则不做处理
                        parent.layer.msg(result.message,{time:1000,icon:2});
                    }
                }
            });
        });

    });




       /* $('#btn_save').on("click", function () {

            $.messager.progress();	// 显示进度条
            var data=$("#verifyForm").serializeJson();
            //alert(JSON.stringify(data));
            $('#verifyForm').form('submit', {
                url: ROOT_PATH + '/risk/recognise/verifyApplication.shtml',
                data:data,
                onSubmit: function (param) {
                    return true;	// 返回false终止表单提交
                },
                success: function (result) {
                    try {
                        result = $.parseJSON(result);
                    }catch (e) {
                        $.messager.progress('close');
                        parent.layer.msg(result.message,{time:1000,icon:2});
                    }
                    if (result.success){
                        $.messager.progress('close');	// 如果提交成功则隐藏进度条
                        parent.layer.msg(result.message,{time:1000,icon:1},function () {
                            parent.$('#dg1').datagrid('load');
                            parent.layer.closeAll(); //先得到当前iframe层的索引
                        });
                    }else {
                        $.messager.progress('close');	// 如果提交失败则不做处理
                        parent.layer.msg(result.message,{time:1000,icon:2});
                    }
                }
            });
        });



    /!***
     * 打开下一环节处理人选择页面
     *!/
    function openSelectUserPage(){
        var index = layer.open({
            type: 2,
            title: '选择下一环节处理人',
            area: ['80%', '80%'],
            content: ROOT_PATH + '/permission/user/simpleList.shtml'
        });
    }
    /!***
     * 得到选择的人员
     *!/
    function getSelectedUser(data){
        var userData=data[0];
        alert(JSON.stringify(userData));
        $("input[name='workflowReview.nextUsers']").val(userData.name);
        $("input[name='workflowReview.nextUserName']").val(userData.realName);
    }*/
</script>
</html>
